<?php
$lunchType = $_POST["lunchType"];
$lunchPs = $_POST["lunchPs"];
$userName = $_POST['userName'];
$orderTime = date('H:i, jS F Y');
if (!$lunchType) {
	echo "未选择午餐类型，请返回重选！";
}

else
{
	if (empty($userName)) {
		echo "您好，"."您的订单： ";;
	}
	else{
		echo $userName."，"."您的订单： ";
	}
	echo "<br />午餐类型： ".$lunchType;
	echo "<br />备注： ".$lunchPs;
	echo "<br />订餐时间： ".$orderTime;
}

if (!get_magic_quotes_gpc()) {
	$lunchType = addslashes($lunchType);
	$lunchPs = addslashes($lunchPs);
}


@ $db = new mysqli("127.0.0.1","liangjian","123456","lunchorder");

if (mysqli_connect_errno()) {
	echo '无法连接数据库';
}
$db->set_charset("utf8");

$query = "insert into lunchorder.order values('','$userName','$lunchType','$lunchPs','$orderTime')";

$result = $db->query($query);
echo "<br />".$db->affected_rows;
$db->close();
?>